﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Text;

namespace _180FrameWork.CustControls
{
    public partial class CustCodeEditer : FastColoredTextBoxNS.FastColoredTextBox, ICustControl
    {
        private bool _IsBind = false;
        public bool IsBind { get { return this._IsBind; } protected set { this._IsBind = value; } }

        private string _PropertName = "";
        public string PropertName { get { return this._PropertName; } set { this._PropertName = value; } }

        private string _QueryName = "";
        public string QueryName { get { return this._QueryName; } set { this._QueryName = value; } }

        private string _RegexText = "";
        public string RegexText { get { return this._RegexText; } set { this._RegexText = value; } }
        
        public CustCodeEditer()
        {
            InitializeComponent();
        }

        public CustCodeEditer(IContainer container)
        {
            container.Add(this);

            InitializeComponent();
        }

        public void SetValue(object strValue)
        {
            this.Text = strValue.ToString();
        }

        public object GetValue()
        {
            return this.Text;
        }

        public void Binding(object DataSource, string DataMember)
        {
            this.DataBindings.Add("Text", DataSource, DataMember);
            IsBind = true;
        }

        public void Clean()
        {
            this.Text = "";
        }

        public void GetFocus()
        {
            base.Focus();
        }
    }
}
